<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<title>Technical details - Macros</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../styles/styles.css">
</head>

<body>

<h1>Technical details</h1>
<div class="navbar">
<a href="../index.html">main</a> |
<a href="index.html">Macros</a>
</div>

<a name="register"></a>
<h3>Storing macro commands</h3>
<p>FAR macro commands are located in Windows registry under <code>[HKEY_CURRENT_USER\Software\Far\[Users\USERNAME\]KeyMacros]</code>
registry key in a text form.
<p>Macro commands are divided into 16 <a href="about/macroarea.html">areas of execution</a> and 2 areas to store global variables and constants.
Area name corresponds to the registry key:
<table class="cont">
  <tr class="cont">
    <th class="cont" width="40%">Area</th>
    <th class="cont" width="60%">Purpose</th>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Shell&quot;</td>
    <td class="cont" width="60%">File panels</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Viewer&quot;</td>
    <td class="cont" width="60%">Internal file viewer</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Editor&quot;</td>
    <td class="cont" width="60%">Internal file editor</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Dialog&quot;</td>
    <td class="cont" width="60%">Dialog boxes</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Search&quot;</td>
    <td class="cont" width="60%">Quick file search</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Disks&quot;</td>
    <td class="cont" width="60%">Drive selection menu</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;MainMenu&quot;</td>
    <td class="cont" width="60%">Main menu</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Menu&quot;</td>
    <td class="cont" width="60%">Other menus</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Help&quot;</td>
    <td class="cont" width="60%">Help system</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Info&quot;</td>
    <td class="cont" width="60%">Informational panel</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;QView&quot;</td>
    <td class="cont" width="60%">Quick view panel</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Tree&quot;</td>
    <td class="cont" width="60%">Folder tree panel</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;FindFolder&quot;</td>
    <td class="cont" width="60%">Folder search panel</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;UserMenu&quot;</td>
    <td class="cont" width="60%">User menu</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Other&quot;</td>
    <td class="cont" width="60%">Screen capturing mode</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Common&quot;</td>
    <td class="cont" width="60%">Common area. Macros created in this area can be used everywhere.
    This area has the lowest priority while processing macros.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Vars&quot;</td>
    <td class="cont" width="60%">Global variables area read by FAR during startup.
    Variables can be string (REG_SZ) and numeric (REG_QWORD). One can write to this area using
    <a href="macrocmd/functions.html#msave">msave()</a> function.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&quot;Consts&quot;</td>
    <td class="cont" width="60%">Global constants area read by FAR during startup.
    Constants can be string (REG_SZ) and numeric (REG_QWORD).</td>
  </tr>
</table>

<p>Every macro command is stored in a separate sub key of the certain area of execution,
which name is assigned to a new shortcut name and contains a set of values that define the
macro command behaviour.
<table class="cont">
  <tr class="cont">
    <th class="cont" width="25%">Name</th>
    <th class="cont" width="10%">Type</th>
    <th class="cont" width="10%">Default</th>
    <th class="cont" width="55%">Description</th>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">Sequence</td>
    <td class="cont" width="10%">REG_SZ<br>REG_MULTI_SZ</td>
    <td class="cont" width="10%">&nbsp;</td>
    <td class="cont" width="55%">Contains the sequense of the keystrokes.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">DisableOutput</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Disable screen output while executing the macro. When
    user creates new macro FAR sets this parameter to 1 (disable screen output). If this
    parameter is omitted FAR uses its default value and enables screen output.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">RunAfterFARStart</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute macro command after FAR startup. This flag applies only to macros that start in the <dfn>Shell</dfn> area.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">EmptyCommandLine</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute this macro only if command line is empty.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NotEmptyCommandLine</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute this macro only if command line is not empty.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoFilePanels</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro for a file panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoFilePPanels</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro for a passive file panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoPluginPanels</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro for a plugin panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoPluginPPanels</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro for a passive plugin panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoFolders</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro if the current element is a folder.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoPFolders</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro if the current element is a folder for a passive panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoFiles</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro if the current element is a file.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoPFiles</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Do not execute this macro if the current element is a file for an inactive panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">Selection</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute only if there are any selected elements on the panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">PSelection</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute only if there are any selected elements on the passive panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoSelection</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute only if there are no selected elements on a panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoPSelection</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute only if there are no selected elements on a passive panel.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">EVSelection</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute if there is a selected text block in the viewer, editor or dialog text boxes.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoEVSelection</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Execute if there is no selected text block in the viewer, editor or dialog text boxes.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">NoSendKeysToPlugins</td>
    <td class="cont" width="10%">REG_DWORD</td>
    <td class="cont" width="10%">0</td>
    <td class="cont" width="55%">Special mode: don't send keystrokes to the plugins during recording and executing.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="25%">Description</td>
    <td class="cont" width="10%">REG_SZ</td>
    <td class="cont" width="10%">&nbsp;</td>
    <td class="cont" width="55%">Macro command description.</td>
  </tr>
</table>
<p>There's only one mandatory parameter &quot;Sequence&quot;, other parameters
can be omitted and they will have the default values according to their specifications.
<p>The &quot;Sequence&quot; parameter contains literal representation of the command
sequence. Every keystroke is represented by its string equivalent delimited by
space or tab character.
<p>During startup FAR compiles command sequence for every macro command defined
into internal byte code representation. If there is any error during compilation of the
macro command then the macro will be ignored.<a name="startmacro"></a>
<h3>Execution conditions</h3>
<p>Before executing the macro FAR checks the execution conditions in the following order:
<ol>
  <li>NoSendKeysToPlugins
  <li>EmptyCommandLine + NotEmptyCommandLine
  <li>NoFilePanels + NoPluginPanels
  <li>NoFilePPanels + NoPluginPPanels
  <li>NoFolders + NoFiles
  <li>NoPFolders + NoPFiles
  <li>Selection + NoSelection (outside Viewer, Editor and Dialog)
  <li>PSelection + NoPSelection (outside Viewer, Editor and Dialog)
  <li>EVSelection + NoEVSelection (inside Viewer, Editor and Dialog)
</ol>

<div class=see>See also:</div><div class=seecont>
<a href="about/index.html">General background</a>,
<a href="macrokey/index.html">Using macros</a>,
<a href="macrocmd/index.html">Macro-language</a>,
<a href="examples.html">Examples</a>
</div>

</body>

</html>
